<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>更改供应商</title>
    <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all">
    <link rel="stylesheet" href="__CSS__/admin.css"  media="all">
</head>

<body>
<div style="margin-top:40px;">
</div>
<form class="layui-form" id="admin">
    <div class="layui-form-item">
        <label class="layui-form-label">供应商</label>
        <div class="layui-input-inline">
            <input type="hidden" name="id" value="{$id}">
            <select name="supplier"  lay-filter="supplier" lay-verify="required" lay-search>
                <option value="">请选择</option>
                {volist name="supplierList" id="vo"}
                <option value="{$vo.company_id}" {if $supplier_id==$vo.company_id} selected{/if}>{$vo.supplier_name}</option>
                {/volist}
            </select>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="admin">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>



<script src="__PUBLIC__/layui/layui.js"></script>
<script src="__PUBLIC__/jquery/jquery.min.js"></script>
<script>
    layui.use(['layer', 'form'], function() {
        var layer = layui.layer,
            $ = layui.jquery,
            form = layui.form;
        $(window).on('load', function() {
            //景点
            form.on('submit(admin)', function() {
                $.ajax({
                    url:"{:url('admin/product/changesupplierid')}",
                    data:$('#admin').serialize(),
                    type:'post',
                    async: false,
                    success:function(res) {
                        layer.msg(res.msg);
                        if(res.code == 1) {
                            setTimeout(function(){
                                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                                //parent.location.href=res.url;
                                parent.location.reload();
                                parent.layer.close(index); //再执行关闭
                            },1500)
                        }
                    }
                });
                return false;
            });
        });
    });
</script>
</body>
</html>
